扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:builder.com.cn 2007年4月26日
关键字: SQL Server
在本页阅读全文(共4页)
/* count the ingredients required */
SELECT
[Recipe Ingredients].RecipeID,
Count([Recipe Ingredients].IngredientID) AS Required
FROM
[Recipe Ingredients]
GROUP BY
[Recipe Ingredients].RecipeID;
/* count the ingredients available */
SELECT
[Recipe Ingredients].RecipeID,
Count(Pantry.IngredientID) AS Available
FROM Pantry
RIGHT JOIN [Recipe Ingredients]
ON Pantry.IngredientID = [Recipe Ingredients].IngredientID
GROUP BY
[Recipe Ingredients].RecipeID;
濡傛灉鎮ㄩ潪甯歌揩鍒囩殑鎯充簡瑙T棰嗗煙鏈€鏂颁骇鍝佷笌鎶€鏈俊鎭紝閭d箞璁㈤槄鑷抽《缃戞妧鏈偖浠跺皢鏄偍鐨勬渶浣抽€斿緞涔嬩竴銆�